package interfaceUtil;

//Comparable
class Person implements Comparable<Person>{
	String name;
	int age;
	double weight;
	public Person(String name, int age,double weight) {
		this.name = name;
		this.age = age;
		this.weight = weight;
	}
	//
	@Override
	public int compareTo(Person o) {
		/*if(this.age > o.age){
			return 1;
		}else if(this.age < o.age){
			return -1;
		}else{
			
			return 0;
		}*/
		//return this.weight > o.weight ? 1: this.weight < o.weight ? -1 :0;
		return this.name.compareTo(o.name);
	}

}



public class ComparableTest {
	public static void main(String[] args) {
		Person p1 = new Person("zs",23,11.111);
		Person p2 = new Person("lisi",21,11.112);
		
		System.out.println(p1.compareTo(p2));
	
	
	
	
	
	
	
	
	
	
	
	
	}
}
